package net.vmiranda.jeds.web.util;

import java.util.Iterator;
import java.util.Map;

import javax.faces.context.FacesContext;

public class Params {
	
	@SuppressWarnings("unchecked")
	public static Object  get(String key){
		Object res = null;
		FacesContext fc = FacesContext.getCurrentInstance();
		java.util.Map requestParameter = fc.getExternalContext().getRequestParameterMap();
		for (Iterator it = requestParameter.entrySet().iterator(); it.hasNext();) {
			Map.Entry entry = (Map.Entry) it.next();
			Object keyActual = entry.getKey();
			if(key.equals(keyActual)){
				res = entry.getValue();
			}
		}
		return res;
	}
	
	public static String getString(String key){
		Object res = get(key);
		return res!= null?res.toString():null;
	}

	

	
}
